import 'package:common/common.dart';

class MainBloc extends Bloc<MainEvent, MainState> {
  MainState _currentState;

  MainBloc(MainState initialState) : super(initialState) {
    _currentState = initialState;
  }

  @override
  Stream<MainState> mapEventToState(MainEvent event) async* {
    if (event is GetDataEvent) {
      _currentState.word = "hello world";
      yield _currentState.copy();
      return;
    }
  }
}

abstract class MainEvent {}

class GetDataEvent extends MainEvent {}

class MainState {
  String word;

  MainState copy() {
    var mainState = MainState();
    mainState.word = word;
    return mainState;
  }
}
